package com.mvvm.start.main.mvvm.vm

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.mvvm.start.base.base.BaseViewModel
import com.mvvm.start.main.bean.result.MarketResult
import com.mvvm.start.main.bean.to.PageSizeAndNumTo
import com.mvvm.start.main.mvvm.m.MarketScriptRepository

/**
 * @author
 * @功能:市场Fragment
 * @Creat 12/23/20 11:30 AM
 * @Compony 465008238@qq.com
 */
class MarketFragmentViewModle : BaseViewModel() {
    fun getMarketListPagingData(): LiveData<PagingData<MarketResult.Record>> {
        return MarketScriptRepository.getMarketListPagingData().cachedIn(viewModelScope)
    }

    /**
     * 刷新
     */
    fun refresh() {
        checkResultRefresh {
            getMarketListPagingData()
        }
    }
}
